FROM m.daocloud.io/docker.io/library/golang:1.24.5-alpine as builder

ENV GO111MODULE on
ENV GOPROXY https://goproxy.cn,direct

WORKDIR /go/src/project001/
ADD ./project001 ./

RUN go mod download
RUN go mod verify

# Compile the binary and statically link
RUN CGO_ENABLED=0 go build -ldflags '-d -w -s'

FROM m.daocloud.io/docker.io/library/alpine:3.7 as project001

ENV APP_DIR /go/src/project001/
WORKDIR $APP_DIR

COPY --from=builder /go/src/project001/project001 $APP_DIR
# COPY --from=builder /go/src/project001/conf ${APP_DIR}conf
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /etc/localtime


EXPOSE 8011

CMD [ "/go/src/project001/main"]